export default {
    buyGoods({state,commit},payload){
        return new Promise((resolve, reject) => {

            let oldProduct = state.cartList.find(item => {
                return item.iid == payload.iid
               
    
            })
            if(oldProduct) {
                resolve('商品数量+1')
                commit('addCount',oldProduct)
            }else {
                // 添加是否选中属性
                payload.check = false;
                payload.count = 1;
                commit('addCart',payload)
                resolve('商品添加成功')
            }
            
        })

        
    },
    chose({commit},id) {
        commit('changeStatus',id)
    },
    buyAll({commit}) {
        commit('toSelectAll')
    }
}